// entity.h : contains the definition of the entity component, which all objects must have
// it includes common things like position and entity name
//$Id: Entity.h 25 2009-08-21 02:02:10Z brwarner2 $

#pragma once
#include "component.h"

//Entity component class
class CEntity :
	public IComponent
{
public:
	//Initialization
	void Init( const ParameterList &params );

	//Gets the world name of the entity
	std::string WorldName( void ) { return m_entityName; }

	//Gets the world position
	bug::math::CVector Position(void) { return m_vPos; }

	//Messaging function for communication
	void Message( MessageID message, const boost::any& arg = 0 );

	//Handler for GM function calls
	virtual int GMCall( gmThread*, const std::string& name );

	//Sets world position
	void Position( const bug::math::CVector& v, bool bAsk = true );

	//Game monkey registration function
	static void RegisterGM( gmMachine* );

	//Component ID
	static const ComponentID COMPONENT_ID = 1;

	//Get component ID
	ComponentID GetComponentID(void) { return COMPONENT_ID; }

	//Factory function
	static IComponent* Factory(void) { return new CEntity(); }

	//Destruct function
	static void Destruct( IComponent* pEnt ) { delete (pEnt); }

private:
	//Entity position
	bug::math::CVector m_vPos;
	
	//Game entity name
	std::string m_entityName;

	//Saved creation parameters
	ParameterList m_savedParams;
};
